<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="<c:url value='/js/jquery-1.11.1.min.js'/>"></script>
<script src="js/bootstrap.min.js"></script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>衣服列表</title>
<script type="text/javascript">
	function changePage(method) {
		
		var pageNo = document.forms[0].pageNo.value;
		var total = document.forms[0].total.value;
		if (method == "next") {
			if (parseInt(pageNo) >= parseInt(total)) {
				alert("当前已经是最后一页！");
				return false;
			} else {
				document.forms[0].pageNo.value = parseInt(pageNo) + 1;
			}
		}
		if (method == "previous") {
			if (parseInt(pageNo) <= 1) {
				alert("当前已经是第一页");
				return false;
			} else {
				document.forms[0].pageNo.value = parseInt(pageNo) - 1;
			}
		}
		if (method == "first") {
			document.forms[0].pageNo.value = 1;
		}
		if (method == "end") {
			document.forms[0].pageNo.value = total;
		}

		document.forms[0].submit();
	}
</script>
</head>
<body>

	<form action="<c:url value='/ClothingAction?oper=clothinglist'/>" method="post">
		<input type="hidden" name="pageNo" value="${pageNo}"> 
		<input type="hidden" name="total" value="${total}"> 
	</form>
	
	<nav class="navbar navbar-default" role="navigation">
   <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" 
         data-target="#example-navbar-collapse">
         <span class="sr-only">切换导航</span>
         <span class="icon-bar"></span>
         <span class="icon-bar"></span>
         <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="<c:url value='/AdminInfoAction?oper=back'/>">欢迎您：${adminInfologin.adminName }</a>
   </div>
   <div class="collapse navbar-collapse" id="example-navbar-collapse">
      <ul class="nav navbar-nav">
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">用户管理<b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
               <li><a href="<c:url value='/AdminInfoAction?oper=userlist'/>">用户列表</a></li>
            </ul>
         </li>
         <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">订单管理<b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
               <li><a href="<c:url value='/AdminInfoAction?oper=ordermanage'/>">订单列表</a></li>
            </ul>
         </li>
         <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">衣服管理<b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
               <li><a href="<c:url value='/ClothingAction?oper=clothinglist'/>">查看所有衣服</a></li>
               <li><a href="<c:url value='/ClothingAction?oper=clothingsave'/>">上架衣服</a></li>
            </ul>
         </li>
          <li><a href="<c:url value='/AdminInfoAction?oper=loginout'/>">退出登录</a></li>
      </ul>
   </div>
</nav>
	<table>
		<tr>
			<td>名称</td>
			<td>价格</td>
			<td>售价</td>
			<td>尺寸</td>
			<td>颜色</td>
			<td>类别</td>
			<td>描述</td>
			<td>上架时间</td>
			<td>图片</td>

		</tr>


		<c:forEach items="${clothinglist }" var="clothing">
			<tr>
				<td>${clothing.name}</td>
				<td>${clothing.price}</td>
				<td>${clothing.saleprice}</td>
				<td>${clothing.size}</td>
				<td>${clothing.color }</td>
				<td>${clothing.kind.season}</td>
				<td>${clothing.summary}</td>
				<td>${clothing.uptime }</td>
				<td>${clothing.picture}</td>

				<td><a href="<c:url value='/ClothingAction?oper=delete&id=${clothing.id}'/>">下架</a></td>
				<td><a href="<c:url value='/ClothingAction?oper=edit&id=${clothing.id}'/>">修改</a></td>
				<td><a href="<c:url value='/ClothingAction?oper=get&id=${clothing.id}'/>">查看</a></td>

			</tr>
		</c:forEach>

		<tr>
			<td colspan="3">查询到：${count}条记录
			<a href="#" onclick="changePage('first')">首页</a> 
			<a href="#" onclick="changePage('previous')">上一页</a> 
			<a href="#" onclick="changePage('next')">下一页</a>
			 第${ pageNo}页/共${total}页
			<a href="#" onclick="changePage('end')">尾页</a>
			</td>
		</tr>
	</table>
</body>
</html>